using System;

namespace CinemaDirector
{
	[Serializable]
	public class GGVariable
	{
		public enum StoreType
		{
			Value = 0,
			Variable = 1
		}

		public StoreType type;

		public string name;

		[NonSerialized]
		public GGVariableStore localStore;

		public void Init(GGVariableStore localStore)
		{
			this.localStore = localStore;
		}

		public T GetVariable<T>(GGVariableStore store) where T : GGVariable, new()
		{
			if (type == StoreType.Variable && store != null && store.ContainsVariable(name))
			{
				return store.GetVariable<T>(name);
			}
			return this as T;
		}
	}
}
